package Java.BlackHorse.Thread.ThreadMethod3;

public class ThreadDemo {
    /*
    * final void setDaemon(boolean on) 设置守护线程
    * 当非守护线程执行完毕后，守护线程也会自动结束
    * */
    public static void main(String[] args) {
        MyThread1 mt1 = new MyThread1();
        MyThread2 mt2 = new MyThread2();
        Thread t1 = new Thread(mt1,"主线程");
        Thread t2 = new Thread(mt2,"守护线程");
        t2.setDaemon(true);
        t1.start();
        t2.start();
    }
}
